package api.list.practice01;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class SubList {
    public static void main(String[] args) {
        Random random = new Random();
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i <8 ; i++) {
            list.add(i, random.nextInt(10));
        }
       // System.out.println(list);


        List<Integer> sub = list.subList(3,8);
        System.out.println(list);
        System.out.println(sub);

        //对原集进行操作后,子集也会改变
        list.set(4,10000);
        System.out.println(list);
        System.out.println(sub);

    }
}
